package conterlles

import (
	"day12_10_homework/models/mysql"
	"github.com/gin-gonic/gin"
	"net/http"
	"strconv"
)

func ListVideo(c *gin.Context) {
	page := c.Query("page")
	pageSize := c.Query("pageSize")
	keyWord := c.Query("keyWord")
	pages, _ := strconv.Atoi(page)
	size, _ := strconv.Atoi(pageSize)
	list, err := mysql.List(keyWord, pages, size)
	if err != nil {
		c.JSON(http.StatusOK, JsonRes{
			Code:    500,
			Message: "视频展示失败",
			Data:    nil,
		})
		return
	}
	c.JSON(http.StatusOK, JsonRes{
		Code:    500,
		Message: "视频展示成功",
		Data:    list,
	})
}
